/*
 * Copyright (C) ${year} Jeffrey Palm.
 *
 * This code is part of the Floto Project (http://jeffpalm.com/floto/).
 * Please consult the LICENSE included in the distribution.
 */
package com.jeffpalm.floto.isight;

import java.awt.image.BufferedImage;

public abstract class AbstractCapture implements Capture {

  /**
   * Instances of this class will implement the {@Link WebcamCapture} interface.
   */
  public abstract static class Webcam extends AbstractCapture implements WebcamCapture {
    public final String getName() {
      return "webcam";
    }
  }

  /**
   * Instances of this class will implement the {@Link ScreenShotCapture}
   * interface.
   */
  public abstract static class ScreenShot extends AbstractCapture implements ScreenShotCapture {
    public final String getName() {
      return "screenshot";
    }    
  }

  protected final Snapshot newSnapshot(BufferedImage image, int width, int height) {
    return new SnapshotImpl(image, width, height);
  }

  public final class SnapshotImpl implements Capture.Snapshot {

    private final BufferedImage image;
    private final int width;
    private final int height;

    SnapshotImpl(BufferedImage image, int width, int height) {
      this.image = image;
      this.width = width;
      this.height = height;
    }

    public SnapshotImpl(BufferedImage image) {
      this(image, image.getWidth(), image.getHeight());
    }

    public BufferedImage getImage() {
      return image;
    }

    public int getHeight() {
      return height;
    }

    public int getWidth() {
      return width;
    }
  }
}
